{extend name="base" /} {block name="body"}
<div class="layui-body">
	<div class="navbar">
		<a><cite>商品管理</cite></a>&nbsp;<span class="layui-box">&gt;</span>
		<a href=""><cite>编辑商品</cite></a>
	</div>
	<!--tab标签-->
	<div class="layui-tab layui-tab-card margin10">
		<ul class="layui-tab-title">
			<li class="layui-this">编辑商品</li>
		</ul>
		<div class="layui-tab-content">
			<form class="layui-form form-container layui-form-pane" action="" method="post">
				<div class="layui-form-item">
					<label class="layui-form-label">商品名称</label>
					<div class="layui-input-block">
						<input type="text" name="name" value="{$shop['name']}" lay-verify="required" placeholder="请输入商品名称" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">商品编号</label>
					<div class="layui-input-block">
						<input type="text" name="sn" value="{$shop['sn']}" lay-verify="required" placeholder="请输入商品标号" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">销售价</label>
					<div class="layui-input-block">
						<input type="text" name="money" value="{$shop['money']}" lay-verify="required" placeholder="请输入销售价" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">累计销量</label>
					<div class="layui-input-block">
						<input type="text" name="sales" value="{$shop['sales']}" lay-verify="required" placeholder="请输入累计销量" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">上架状态</label>
					<div class="layui-input-block">
						<select name="is_on_sale" lay-verify="required">
							<option value="1" {if $shop['is_on_sale']==1} selected="selected" {/if}>上架</option>
							<option value="2" {if $shop['is_on_sale']==2} selected="selected" {/if}>下架</option>
							</select>
							</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">图标</label>
					<div class="layui-input-block" style="padding-left: 10px;">
						<div class="layui-upload">
							<button type="button" class="layui-btn" id="image">上传图片</button>
							<div class="layui-upload-list">
								<img class="layui-upload-img" src="{$shop['thumb']}" style="width: 150px;height: 150px;" id="demo1">
								<p id="demoText"></p>
							</div>
						</div>
					</div>
				</div>
					<div class="layui-form-item">
					<label class="layui-form-label">商品详情</label>
					<div class="layui-input-block"  >
 					<textarea placeholder="请输入内容" class="layui-textarea" name="editorValue" id='containe' value="{$shop['editorValue']}">{$shop['editorValue']}</textarea>							
					</div>
				</div>
				<input type="hidden" name="thumb" id="thumb" value="{$shop['thumb']}"/>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter=""><i class="fa fa-save"></i> 保存</button>
						<a href="{:url('goods')}" class="layui-btn layui-btn-primary"><i class="fa fa-arrow-left"></i> 返回</a>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
  <link rel="stylesheet" src="/public/static/layui/css/layui.css"  media="all">
  <script src="/public/static/layui/layui.js" charset="utf-8"></script>
   <script id="containe" name="content" type="text/plain">
        这里写你的初始化内容
    </script>
     配置文件 
    <script type="text/javascript" src="/PUBLIC/ueditor/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="/PUBLIC/ueditor/ueditor.all.js"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('containe');
    </script>-->
{/block} {block name="js"}
<script>

layui.use('upload', function() {
		var upload = layui.upload,
		jq = layui.jquery;
		upload.render({
			url: '{:url("upload")}',
			elem: '#image',
			ext: 'jpg|png|gif',
			area: ['500', '500px'],
			before: function(input) {
				
			},
			done: function(res) {
				if(res.code==1){
					$("#demo1").attr('src',res.src);
					$("#thumb").val(res.src);
				}
			}
		});

})
	
</script>
{/block}